//
//  ALPHead1View.m
//  AlpFM
//
//  Created by dllo on 16/1/26.
//  Copyright © 2016年 Alp. All rights reserved.
//

#import "ALPHead1View.h"
#import "UIImageView+WebCache.h"
@implementation ALPHead1View
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}
- (void)createSubViews{
    
    UIView *headView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 375, 200)];
//    headView.backgroundColor = [UIColor redColor];
    [self addSubview:headView];
    self.book = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, (375 - 30) / 2 + 1, 180)];
    self.book.backgroundColor = [UIColor blueColor];
    [headView addSubview:self.book];
    self.music = [[UIImageView alloc]initWithFrame:CGRectMake((375 - 25) / 2 + 15, 10, self.book.frame.size.width / 2, self.book.frame.size.height / 2 - 3)];
    self.music.backgroundColor = [UIColor yellowColor];
    [headView addSubview:self.music];
    self.recreation = [[UIImageView alloc]initWithFrame:CGRectMake(self.music.frame.origin.x + 92, 10, self.music.frame.size.width, self.music.frame.size.height)];
    self.recreation.backgroundColor = [UIColor greenColor];
    [headView addSubview:self.recreation];
    
    
    self.storytelling = [[UIImageView alloc]initWithFrame:CGRectMake((375 - 25) / 2 + 15, 103, self.music.frame.size.width, self.music.frame.size.height)];
    self.storytelling.backgroundColor = [UIColor blackColor];
    [headView addSubview:self.storytelling];
    
    
    self.child = [[UIImageView alloc]initWithFrame:CGRectMake(self.recreation.frame.origin.x, self.storytelling.frame.origin.y, self.music.frame.size.width, self.music.frame.size.height)];
    self.child.backgroundColor = [UIColor purpleColor];
    [headView addSubview:self.child];
    
}
- (void)setArray:(NSArray *)array{
    _array = array;
    ALPClassModel *modelBook = [[ALPClassModel alloc]init];
    modelBook = self.array[0];
    [self.book sd_setImageWithURL:[NSURL URLWithString:modelBook.coverPath]];
    ALPClassModel *modelmusic = [[ALPClassModel alloc]init];
    modelmusic = self.array[1];
    [self.music sd_setImageWithURL:[NSURL URLWithString:modelmusic.coverPath]];
    ALPClassModel *modelrecreation = [[ALPClassModel alloc]init];
    modelrecreation = self.array[2];
    [self.recreation sd_setImageWithURL:[NSURL URLWithString:modelrecreation.coverPath]];
    ALPClassModel *modelstorytelling = [[ALPClassModel alloc]init];
    modelstorytelling = self.array[3];
    [self.storytelling sd_setImageWithURL:[NSURL URLWithString:modelstorytelling.coverPath]];
    ALPClassModel *modelchild = [[ALPClassModel alloc]init];
    modelchild = self.array[4];
    [self.child sd_setImageWithURL:[NSURL URLWithString:modelchild.coverPath]];

}

@end
